
(function(){function f(a){return"false"==a?!1:(a=/(?:\?v=|\/embed\/|\.be\/)([-a-z0-9_]+)/i.exec(a)||/^([-a-z0-9_]+)$/i.exec(a))?a[1]:!1}var g=function(){var a={};return function(b){var c=$.Deferred();b in a?a[b]?c.resolve(a[b]):c.reject("Preview image not found."):$("<img>").on("load",function(){if(120==(this.naturalWidth||this.width)){var d=this.src.split("/").pop();switch(d){case "maxresdefault.jpg":this.src=this.src.replace(d,"sddefault.jpg");break;case "sddefault.jpg":this.src=this.src.replace(d,
"hqdefault.jpg");break;case "hqdefault.jpg":this.src=this.src.replace(d,"default.jpg");break;default:a[b]=null,c.reject("Preview image not found.")}}else c.resolve(a[b]=this.src)}).attr("src","https://img.youtube.com/vi/"+b+"/maxresdefault.jpg");return c}}();$(document).on("add.cards change.cards",function(a){if($(a.target).hasClass("mbr-slider")){var b="add"==a.type,c=$("html").hasClass("desktop"),d=$("html").hasClass("is-builder");$(a.target).outerFind("[data-bg-video-slide]").each(function(){b||
$(".mbr-background-video-preview",this).remove();var a=f($(this).attr("data-bg-video-slide"));if(a){var e=$('<div class="mbr-background-video-preview"></div>').css({display:"none",backgroundSize:"cover",backgroundPosition:"center"});$(".mbr-overlay, .container-slide",this).before(e);g(a).done(function(a){e.css("background-image",'url("'+a+'")').show()});if(b&&c&&!d&&$.fn.YTPlayer&&!$(this).find(".playerBox").length){var h=eval("("+($(this).attr("data-bg-video-slide-params")||"{}")+")");$(".container-slide",
this).before('<div class="mbr-background-video"></div>').prev().YTPlayer($.extend({videoURL:a,containment:"self",showControls:!1,mute:!0},h));a=$(this).find(".mbr-overlay");a.length&&$(".YTPOverlay",this).css({opacity:a.css("opacity"),backgroundColor:a.css("background-color")})}}});b&&($(this).on("slide.bs.carousel","section.mbr-slider",function(a){$(a.target).find(".carousel-item.active .mb_YTPlayer").each(function(){$(this).YTPPause()});$(a.target).find(".carousel-item:not(.active) iframe").css("opacity",
0)}),$(this).on("slid.bs.carousel","section.mbr-slider",function(a){$(a.target).find(".carousel-item.active .mb_YTPlayer").each(function(){$(this).YTPPlay()});$(a.target).find(".carousel-item.active iframe").resize().css("opacity",1)}))}})})();
